//package com.tqjc.business.interactivewithscan.core.operation;
//
//import com.tqjc.business.interactivewithscan.consts.CoordConstant;
//import com.tqjc.business.interactivewithscan.entity.Coord;
//import com.tqjc.business.interactivewithscan.entity.CoordDataEntity;
//import com.tqjc.business.interactivewithscan.entity.CoordSort;
//import com.tqjc.business.interactivewithscan.entity.ScanningData;
//import com.tqjc.business.interactivewithscan.exception.CustomException;
//import com.tqjc.business.interactivewithscan.uils.CommonUtils;
//import com.tqjc.business.interactivewithscan.uils.CoordinatesUtils;
//import com.tqjc.business.interactivewithscan.uils.PTZUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * 更新扫描结果（槽车使用）
// */
//public class UpdateScanningOperation {
//
//    private static Logger logger = LoggerFactory.getLogger(UpdateScanningOperation.class);
//
//
//    private String getYuntaiCode(String code) {
//        switch (code) {
//            case "400001":
//            case "400002":
//                return "300003";
//            case "400003":
//                return "300002";
//            case "100004":
//                return "100003";
//            case "200004":
//                return "200003";
//        }
//        return "";
//    }
//
//    protected boolean operationCommon() {
//        // 获取同跨天车任务
//        CoordDataEntity discharge = deveThread.getDischargeCoords();
//        if (!discharge.isHaveCoord()) {
//            deviceThread.setScanningData(null);
//            YuntaiThread yuntaiThread = DeviceThreadPool.devices.getObject(getYuntaiCode(device.getDeviceCode()), YuntaiThread.class);
//            ScanningData scanningData = PTZUtils.scanning(device, yuntaiThread.getSocketClient());
//            try {
//                List<Coord> areas = CoordinatesUtils.queryArea(scanningData.getScanningArea(), device.getDeviceCode(), scanningData.getScanningDate());
//                if (areas.size() < 4) {
//                    yuntaiThread.setStart(false);
//                    return true;
//                }
//                List<Coord> dems = CoordinatesUtils.yuntaiScanningHandle(scanningData.getScanningDem());
//                CoordinatesUtils.removeShadows(dems);
//                if (dems.size() == 0) {
//                    yuntaiThread.setStart(false);
//                    return true;
//                }
//                int z = dems.stream().min(new CoordSort(4)).get().getZ();
//                if (z < CoordConstant.Tanker_Safe_Height - 1500) {
//                    yuntaiThread.setStart(false);
//                    return true;
//                }
//                boolean b = deviceThread.updateDischarge(sameTask, scanningData);
//                if (!b) {
//                    System.out.println("ssss");
//                    yuntaiThread.setStart(false);
//                    return true;
//                }
//                deviceThread.setOldTask(new ArrayList<>(sameTask));
//            } catch (CustomException e) {
//                System.err.println("【" + device.getDeviceName() + "】" + e.getMsg());
//                yuntaiThread.setStart(false);
//                return true;
//            } catch (Exception e) {
//                e.printStackTrace();
//                yuntaiThread.setStart(false);
//                return true;
//            }
//            deviceThread.setScanningData(scanningData);
//            yuntaiThread.setStart(false);
//        }
//        CommonUtils.sleep(1000);
//        return false;
//    }
//
//
//
//}
